<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>投票活动列表</title>
    <#include "/common/link.ftl">

</head>
<body class="hold-transition skin-black sidebar-mini">
<div class="wrapper">
    <#include "/common/navbar.ftl">

    <#assign currentMenu="activity"/>

    <#include "/common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>投票活动列表</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <form class="form-inline" id="searchForm" action="/xxxx/list" method="post"  style="margin-top: 20px">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">
                </form>
                <!--编写内容-->
                <div class="box-body table-responsive">
                    <table class="table table-hover table-bordered table-striped">
                        <thead>
                        <tr>
                            <th>编号</th>
                            <th>投票主题</th>
                            <th>投票类型</th>
                            <th>投票状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <#list PageInfo.list as a>
                            <tr>
                                <td>${a.id}</td>
                                <td>${a.title}</td>
                                <td><#if a.type==0>
                                     单选
                                    </#if>
                                    <#if a.type==1>
                                        多选
                                    </#if>
                                </td>
                                <td>${a.status?string("投票中","停止投票")}</td>
                                <td>
                                    <a href="#" class="btn btn-info btn-xs btn-input" data-id="${a.id}"  >
                                        <span class="glyphicon glyphicon-arrow-right"></span> 投票
                                    </a>
                                    <a href="#" class="btn btn-info btn-xs btn-read" data-id="${a.id}"  >
                                        <span class="glyphicon glyphicon-arrow-right"></span> 查询
                                    </a>
                                </td>
                            </tr>
                        </#list>


                        </tbody>
                    </table>
                    <#include "/common/page.ftl" >
                </div>
            </div>
        </section>
    </div>
    <#include "/common/footer.ftl" >
</div>



<script>
    $(".btn-input").click(function () {
        var id = $(this).data("id");

        $.get("/activity/vote",{id:id},function (data) {

             if (data.success){
                 window.location.href="/activity/page?id=" +id;
             }else {
                 Swal.fire({
                     title: data.msg,
                     icon: 'warning',
                     confirmButtonText: '好的呢',
                 })
             }

         })

    })

    $(".btn-read").click(function () {
        var id = $(this).data("id");
        window.location.href="/activity/read?id="+id;
    })
</script>

</body>
</html>
